<?php

namespace Library\Models;

use \Library\Entities\Channels;

class UsersManager_PDO extends UsersManager {

    public function getList() {
        $sql = 'SELECT * FROM users ORDER BY name DESC';

        $requete = $this->dao->query($sql);
        $requete->setFetchMode(\PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE, '\Library\Entities\Users');
        $listeUsers = $requete->fetchAll();
        foreach ($listeUsers as $User) {
            //rien pour le moment
        }
        $requete->closeCursor();
        return $listeUsers;
    }
    
    public function getListGroup() {
        $sql = 'SELECT * FROM groups ORDER BY name DESC';

        $requete = $this->dao->query($sql);
        $requete->setFetchMode(\PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE, '\Library\Entities\Users');
        $listeGroups = $requete->fetchAll();
        foreach ($listeGroups as $Group) {
            //rien pour le moment
        }
        $requete->closeCursor();
        return $listeGroups;
    }
    
    public function deleteUser($user) {
        $this->dao->exec("DELETE FROM users WHERE email = '". $user."'");
    }

}

?>
